package com.huawang.mdesign.model.service.controller;

import com.huawang.business.constants.ParamErrorConstants;
import com.huawang.mdesign.model.service.dto.CreateIbdDTO;
import com.huawang.mdesign.model.service.inter.InternalBlockService;
import com.huawang.mdesign.model.service.vo.BaseResponse;
import com.huawang.mdesign.model.service.vo.CreateIbdVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Tag(name = "内部模块")
@RestController
@RequestMapping("/internalBlock")
public class InternalBlockController {
    @Autowired
    private InternalBlockService internalBlockService;

    @Operation(summary = "查询模块下部件属性所在泳道")
    @GetMapping("/queryPartPropertySwimLane")
    public BaseResponse<List<String>> queryPartPropertySwimLane(
            @NotBlank(message = ParamErrorConstants.NO_PROJECT_ID) String projectId,
            @NotBlank(message = ParamErrorConstants.NO_INSTANCE_ID) String instanceId) {
        return BaseResponse.success(internalBlockService.queryPartPropertySwimLane(projectId, instanceId));
    }

    @Operation(summary = "通过活动图快速创建内部模块图")
    @PostMapping("/createIbdBySwimLane")
    public BaseResponse<CreateIbdVo> createIbdBySwimLane(@RequestBody CreateIbdDTO dto) {
        return BaseResponse.success(internalBlockService.createIbdBySwimLane(dto));
    }

}
